;(function($){
	$.fn.indexMenu = function(opt){
		var el = this;
		var opts = {
			appendDivId:"",				//父级divId				*********必填**********
			menu:{},					//菜单				*********必填**********
			app:"frontoffice",			//模块				*********必填**********
			homepage_href:"home#page/homepage",				//主页URL
			indexOff_href:getContextPath()+"/"+opt.app+"/sys/sysuser/logout",	//退出URL
			Dowebok_data:$.HSAPI_ASKJSONINFO( JSON.stringify({}),'Alin_notice_boardRetrieve','{}'),
			Dowebok_url:$.HSAPI_AJAXURL+$.HSAPI_PROCEDURE2_LIST,
			getDataUrl:function(value){
				let data_url=value.data_url;
				if(data_url.indexOf('?')>-1)
					data_url=data_url.split('?')[0]+'.html?'+data_url.split('?')[1]+'&arg='+value.menu_code.trim();
				else
					data_url=data_url.split('?')[0]+'.html?arg='+value.menu_code.trim();

				return data_url;
			},
			showMenuLi: function(value){
				let data_url=opts.getDataUrl(value);
				var html='<li data-menuCode="'+value.menu_code.trim()+'" class="hover">';
				if(value.menu_code.trim()=="ar_search_fbposcs"){//ar账查询
					html+=	'<a data-newTab="no" data-menuCode="'+value.menu_code.trim()+'" onclick="ar_search();" data-url="'+value.data_url+'" href="javascript:void(0);">'+
								'<i class="'+value.menu_class+'"></i>'+$.i18n.propJsp(value.menu_name)+
							'</a>';
				}else{
					html+='<a data-pmenuCode="'+value.parent_menucode+'" data-menuCode="'+value.menu_code.trim()+'" data-name="'+$.i18n.propJsp(value.menu_name)+'" data-url="/'+data_url+'" href="javascript:void(0);">';
					html+='<i class="'+value.menu_class+'"></i>'+$.i18n.propJsp(value.menu_name)+
								'</a>';
				}
				html+=		'</li>';
				return html
			},
			showQckMenuLi: function(value,color){
				let data_url=opts.getDataUrl(value);
				var html=	'<li data-menuCode="'+value.menu_code.trim()+'" class="hover QCKRight ">';
					html+='<a data-menuCode="'+value.menu_code.trim()+'" data-name="'+$.i18n.propJsp(value.menu_name)+'" data-pmenuCode="'+value.parent_menucode+'" data-url="/'+data_url+'" href="javaScript:void(0);">';
				html+='<i class="'+value.menu_class+'" style="color:'+color+'"></i>'+'<span class="menu-text">'+$.i18n.propJsp(value.menu_name)+'</span>'+
								'</a>'+
						'</li>';            		
				return html
			},
			dataBack : function(){},
			returnBack : function(){},
			mode:"default",//url页面加载模式->默认default窗体内加载，newWindow新窗口打开
			newWindow:function(){} //newWindow情况下回调函数
		}
		var param = $.extend(opts,opt);
		var app = new App(el,param);

		$.indexMenu=app;
	}
	
	var App = function(el,param){
		this.el = el;
		this.param = param;
		this.init();
		this.bindEvent();

		//默认打开窗体
		// let configValue=electron.ipcRenderer.sendSync('getConfigMess');
		// switch(configValue.HSAPI_FULLSCREEN){
		// 	case 'op':
		// 		el.find("a[data-menuCode='frontpos']").trigger("click");
		// 		break;
		// }
	}
	
	App.prototype = {
		bindEvent : function(){
			var el = this.el;
			var param = this.param;
			var t = this;
		},
		init:function(){
			var t=this;
			var el = this.el;
			var param = this.param;
				
			$("#"+param.appendDivId).empty()
			var html = 	'<style>'+
							'#menu a.firMenu{padding: 5px 14px;}'+
							'#menu li{border-width: 0;}'+
							'#menuQck li{min-width: 69px;}'+
							'#menuQck li a{text-align: center;}'+
							'#menuQckRight li{min-width: 75px;text-align: center;}'+
						'</style>'+
						'<div class="row hide"  style="border:0px solid #e5e5e5;height:34px;margin:0;background: #438eb9;">'+
							'<ul id="menu" class="nav nav-list" style="display:inline-block;border:0"></ul>'+
							// '<div class="indexDowebok navbar-header pull-right" style="margin-top: 16px;background: center;"></div>'+
						'</div>'+
			            '<div class="nav-list" style="width: 30%;float: left;position: relative;overflow: hidden;height: 69px;padding-left: 0px;padding-right: calc( 5% + 0px );border: 0;">'+
				       		'<div class="fir_next hide" style="position:absolute;left: 0;height: 69px;top:0;width: 20px;background-color: #ebeaeb;z-index: 3;text-align: center;line-height: 70px;">'+
								'<i class="fa fa-chevron-left" style="color: #999;" aria-hidden="true"></i>'+
							'</div>'+
				      		'<ul id="menuQck" style="height: 69px;width: max-content;    position: absolute;border: 0;" class="nav nav-list"></ul>'+
				      		'<div class="fir_prev hide" style="position:absolute;right: 0;height: 69px;top:0;width: 20px;background-color: #ebeaeb;z-index: 3;text-align: center;line-height: 70px;">'+
								'<i class="fa fa-chevron-right" style="color: #999;" aria-hidden="true"></i>'+
							'</div>'+
				        '</div>'+
						'<div class="nav-list" style="width: 70%;float: left;position: relative;overflow: hidden;height: 69px;padding-left: 20px;padding-right: 20px;border: 0;">'+
							'<div class="sec_next" style="position:absolute;left: 0;height: 69px;top:0;width: 20px;background-color: #ebeaeb;z-index: 3;text-align: center;line-height: 70px;">'+
								'<i class="fa fa-chevron-left" style="color: #999;" aria-hidden="true"></i>'+
							'</div>'+
							'<ul id="menuQckRight" style="height: 69px;width: max-content;    position: absolute;border: 0;"  class="nav nav-list"></ul>'+
							'<div class="sec_prev" style="position:absolute;right: 0;height: 69px;top:0;width: 20px;background-color: #ebeaeb;z-index: 3;text-align: center;line-height: 70px;">'+
								'<i class="fa fa-chevron-right" style="color: #999;" aria-hidden="true"></i>'+
							'</div>'+
						'</div>'+
						'<script type="text/javascript">'+
							'try {ace.settings.check("sidebar", "collapsed")} catch (e) {}'+
						'</script>';
			$("#"+param.appendDivId).append(html)
			
			t.showMenu(param.menu)
		},
		showMenu:function(menu_json){
			var t=this;
			var el = this.el;
			var param = this.param;
			
			el.find("#menu").empty();
			el.find("#menuQck").empty();
			el.find("#menuQckRight").empty();
			
			//生成主页面菜单
			//获取全部部门
			var bmhs = new Promise(t.getBmh);
			//异步获取成功
			bmhs.then((data)=>{
				$.HSAPI_MAINMENU(menu_json,data);

				var icon_class="fa-angle-double-up"
				if( localStorage.getItem("menuUpDown")!=null &&  localStorage.getItem("menuUpDown")=="menuSmall"){
					icon_class="fa-angle-double-down"
				}
				var icon_html=	'<li id="menuUpDown" class="" style="width: 32px;text-align: center;line-height: 32px;height: 32px;" >'+ 
							'<i class="ace-icon fa '+icon_class+'" style="padding: 0 5px;line-height: 18px;cursor: pointer;font-size: 14px;border-radius: 100%;border: 1px solid;position: relative;border-color: #bbbbbb;color: #aaaaaa;background-color: #ffffff;"></i>'+
						'</li>';
				el.find("#menu").append(icon_html);
				
				var html =	'<li class="hover">'+ 
								'<a id="homepage" href="javaScript: void(0);" class="firMenu" style="background: #438eb9;color:#FFFFFF">'+ 
									'<span class="menu-text">控制台</span>'+
								'</a>'+ 
								'<b class="arrow"></b>'+	
								'<ul class="submenu" data-menu-id="">'+
									'<li data-menuCode="" class="hover">'+
										'<a id="indexOff" data-menuCode="" data-url="" href="javaScript: void(0);">'+ 
											'<i class="menu-icon  fa fa-power-off"></i>'+$.i18n.propJsp("退出")+
										'</a>'+
									'</li>'+
									// '<li data-menuCode="" class="hover">'+
									// 	'<a id="indexTabsPosition" data-menuCode="" data-url="" href="javaScript: void(0);">'+ 
									// 		'<i class="menu-icon  fa fa-power-off"></i>'+$.i18n.propJsp("tabs切换")+
									// 	'</a>'+
									// '</li>'+
								'</ul>'+
							'</li>';
				el.find("#menu").append(html);
	
				var html_home =	'<li class="hover">'+ 
									'<a data-menu_code="homepage" href="javaScript: void(0);" class="dropdown-toggle">'+
										'<i class="menu-icon fa fa-home"></i>'+
										'<span class="menu-text">任务栏</span>'+
									'</a>'+
								'</li>';
				el.find("#menuQck").append(html_home);
				
				//默认tabs
				let tabsMenus={},doActive=true;
				for(var item in menu_json){ 
					//一级菜单
					if(item=="0"){
						$(menu_json[item]).each(function(key,value){
							var color = "#585858"
							if(value.quick_color && value.quick_color!=""){
								color = value.quick_color
							}
							if(value.app.indexOf(param.app)>-1){
								var html='<li class="hover">'+
											'<a href="'+value.data_url+'" class="dropdown-toggle firMenu" style="background: #438eb9;color:#FFFFFF">'+
												'<span class="menu-text">'+value.menu_name+'</span>'+
											'</a>'+
											'<b class="arrow"></b>'+
											'<ul class="submenu" data-menu-id="'+value.menu_code.trim()+'">'+
											'</ul>'+
										'</li>';
								el.find("#menu").append(html);
							
								if(value.quick && value.quick=="1"){
									var html='<li class="hover">'+
												'<a data-menu_code="'+value.menu_code.trim()+'" href="'+value.data_url+'" class="dropdown-toggle">'+
													'<i class="'+value.menu_class+'" style="color:'+color+'"></i>'+
													'<span class="menu-text">'+value.menu_name+'</span>'+
												'</a>'+
											'</li>';
									el.find("#menuQck").append(html);
								}
							
							}else{
								var html='<li class="hover hide">'+
											'<a  href="'+value.data_url+'" class="dropdown-toggle firMenu" style="background: #438eb9;color:#FFFFFF">'+
												'<span class="menu-text">'+value.menu_name+'</span>'+
											'</a>'+
											'<b class="arrow"></b>'+
											'<ul class="submenu" data-menu-id="'+value.menu_code.trim()+'">'+
											'</ul>'+
										'</li>';
								el.find("#menu").append(html);
							
								if(value.quick && value.quick=="1"){
									var html=	'<li class="hover hide">'+
													'<a data-menu_code="'+value.menu_code.trim()+'" href="'+value.data_url+'" class="dropdown-toggle">'+
														'<i class="'+value.menu_class+'" style="color:'+color+'"></i>'+
														'<span class="menu-text">'+value.menu_name+'</span>'+
													'</a>'+
												'</li>';
									el.find("#menuQck").append(html);
								}
							
							}
							value.menu_code=value.menu_code.trim(); 
						});
						
						
					}else{//二级菜单
						var ul=el.find("#menu").find("ul[data-menu-id='"+item+"']");
						$(menu_json[item]).each(function(key,value){
							menu_json[item][key].menu_code=menu_json[item][key].menu_code.trim();
							if(value.app.indexOf(param.app)>-1){
								var html = param.showMenuLi(value)
								//默认tab页
								if(value.hasOwnProperty('open_type')&&value.open_type=='1'&&param.mode!='default'){
									// console.log(JSON.stringify(value))
									let item={
										'target':'.nav-tabs',
										'id':value.menu_code,
										'title':'<i class="menu-icon fa fa-list" style="color:rgb(209, 91, 71)"></i><span class="menu-text">'+value.menu_name+'</span>',
										'url':'./indexWindow.html#/'+param.getDataUrl(value)+'&open_type=1',
										'ajax':false,
										"parentMenuCode":value.parent_menucode,
										"menuCode":value.menu_code
									}
									if(doActive){
										item.active=true;
										doActive=false;
									}
									tabsMenus['tab_'+value.menu_code]=item;
								}
								   $(ul).append(html);
							} 
						});
					} 
				}

				var menuQckWidth = el.find("#menuQck").width()
				var windowWidth = $("#"+param.appendDivId).width()
				
				if(menuQckWidth>=windowWidth*4/10){
					el.find("#menuQck").parent("div").css("width","40%").css("padding-left","20px").css("padding-right","20px").css("margin-right","10%")
					el.find("#menuQckRight").parent("div").css("width","50%")
					el.find("#menuQck").parent("div").find(".fir_next").removeClass("hide")
					el.find("#menuQck").parent("div").find(".fir_prev").removeClass("hide")
				}else{
					el.find("#menuQck").parent("div").css("width",menuQckWidth+windowWidth*10/100)
					el.find("#menuQckRight").parent("div").css("width",windowWidth-(menuQckWidth+windowWidth*10/100))
				}
				
				el.find("#menuUpDown").unbind("click").click(function(){
					if($(this).find("i").hasClass("fa-angle-double-up")){
						$(this).find("i").removeClass("fa-angle-double-up").addClass("fa-angle-double-down")
						localStorage.setItem("menuUpDown","menuSmall")
						var menu_json = JSON.parse(localStorage.getItem("qckMenu"))
						t.showMenu(menu_json)
						// el.css({"height":83});
					}else{
						$(this).find("i").removeClass("fa-angle-double-down").addClass("fa-angle-double-up")
						localStorage.setItem("menuUpDown","menuBig")
						var menu_json = JSON.parse(localStorage.getItem("qckMenu"))
						t.showMenu(menu_json)
						// el.css({"height":83});
					}
				})
	
				//tab样式切换
				// el.find('#indexTabsPosition').bind('click',function(){
				// 	if($("#indexMenuContent").hasClass('indexMenuFlex')){
				// 		$("#indexMenuContent").removeClass('indexMenuFlex');
				// 		$("#indexMenuContent").addClass('indexMenuFlexBottom');
				// 		localStorage.setItem('indexMenuContentType','indexMenuFlexBottom');
				// 		$.HSAPI_REFRESHINDEX();
				// 	}else{
				// 		$("#indexMenuContent").removeClass('indexMenuFlexBottom');
				// 		$("#indexMenuContent").addClass('indexMenuFlex');
				// 		localStorage.setItem('indexMenuContentType','indexMenuFlex');
				// 		$.HSAPI_REFRESHINDEX();
				// 	}
				// })
				
				//新开页打开新页面
				if(param.mode==='newWindow'){
					el.find("#menu").find("a").each(function(key,value){
						if($(this).attr("id")!="indexTabsPosition"&&$(this).attr('data-menuCode')!="ar_search_fbposcs"){
							let href=$(this).attr("href");
							if(href!='#'){
								$(this).unbind('click').bind('click',function(){
									if($(this).attr("id")=="indexOff"||$(this).attr("id")=="homepage"){
										$.HSAPI_CLOSEWINS();
										window.location.href=param.indexOff_href;
										return false;
									}
									if(!$(this)[0].hasAttribute('data-addtab')){
										$(this).attr('href','javaScript: void(0);');
										let url=$(this).attr('data-url');
										let menuName=$(this).attr('data-name');
										let menuCode=$(this).attr('data-menuCode');
										let parentMenuCode=$(this).attr('data-pmenuCode');
										param.newWindow({'hash':url,'title':menuName,'menuCode':menuCode,'parentMenuCode':parentMenuCode,parent:true});
									}	
								});
							}
						}
					});
				}
				
				//左边快捷点击
				el.find("#menuQck").find("a").unbind("click").click(function(){
				//	el.find("#menuQckRight").parent("div").find(".sec_next").addClass("hide")
				//	el.find("#menuQckRight").parent("div").find(".sec_prev").addClass("hide")
					el.find("#menuQckRight").css("left", "20px");
					el.find("#menuQckRight").empty()
					
					var menu = JSON.parse(localStorage.getItem("qckMenu"));
					var menu_code = $(this).attr("data-menu_code")
					
					var color = $(this).find("i").css("color") 
					
					if(menu_code=="homepage"){
						var html="";
							// html+=	'<li class="hover">'+
							// 			'<a class="indexDep" data-menuCode="indexDep" href="javaScript: void(0);">'+
							// 				'<i class="menu-icon fa fa-users"></i>'+'<span class="menu-text">'+$.i18n.propJsp("部门")+'</span>'+
							// 			'</a>'+
							// 		'</li>'+
							html+='<li data-menuCode="indexOff" class="hover QCKRight ">'+
										'<a id="homepageOff" class="" data-menuCode="" data-pmenuCode="homepage" href="javaScript: void(0);">'+
											 '<i class="menu-icon fa fa-power-off"></i>'+'<span class="menu-text">'+$.i18n.propJsp("注销")+'</span>'+
										 '</a>'+
									'</li>';
									
						el.find("#menuQckRight").append(html);
						
						let _openWins=JSON.parse(localStorage.getItem('openWin'));
						$(_openWins).each(function(key,value){
							if(value.quick_color && value.quick_color!=""){
								color = value.quick_color
							}
							var html= param.showQckMenuLi(value,color)
							el.find("#menuQckRight").append(html);
						})
						
					}else{
						$(menu[menu_code]).each(function(key,value){
							if(value.quick_color && value.quick_color!=""){
								color = value.quick_color
							}
							
							menu[menu_code][key].menu_code=menu[menu_code][key].menu_code.trim();
							if(value.app.indexOf(param.app)>-1 && value.menu_class!="" && value.quick && value.quick=="1"){
								var html= param.showQckMenuLi(value,color)
								el.find("#menuQckRight").append(html);
							} 
						})
					}
					
					var menuQckRightWidth = el.find("#menuQckRight").width();
					var menuQckRightDivWidth = el.find("#menuQckRight").parent("div").width();
					if(menuQckRightWidth>menuQckRightDivWidth){
				//		$("#menuQckRight").parent("div").find(".sec_next").removeClass("hide")
				//		$("#menuQckRight").parent("div").find(".sec_prev").removeClass("hide")
					}
					
					var menuQckLeft = parseInt($("#menuQck").css("left"))
					var menucode = $(this).attr("data-menu_code")
					var json_menuQck = {"left":menuQckLeft,"menucode":menucode}
					localStorage.setItem("menuQck",JSON.stringify(json_menuQck))
	
					// //获取全部部门
					// var bmhs = new Promise(t.getBmh);
					// //异步获取成功
					// bmhs.then((data)=>{
					// 	data.reverse().map((v)=>{
					// 		let item=`<li class="hover QCKRightDeps hide">
					// 						<a data-bh='${v.bh}' href="javaScript: void(0);">
					// 							<div>${v.mc}</div>
					// 							<span class="menu-text">${v.bh}</span>
					// 						</a>
					// 					</li>`;
					// 		el.find("#menuQckRight").find("li:first").after(item);
					// 	});
	
					// 	el.find('.indexDep').click(function(){
					// 		if($('.QCKRightDeps').hasClass('hide'))
					// 			$('.QCKRightDeps').removeClass('hide');
					// 		else
					// 			$('.QCKRightDeps').addClass('hide');
					// 	});
	
					// 	el.find(".QCKRightDeps a").unbind("click").click(function(e){
					// 		let bm=$(this).attr('data-bh');
					// 		jQuery.ajax( {  
					// 			type : 'POST',  
					// 			url : $.HSAPI_AJAXURL+"/qms/mobile/getToken",
					// 			data : {
					// 				dep:bm
					// 			},
					// 			dataType : 'json',    
					// 			async:false,
					// 			success : function(data) {
					// 				if(data.RETURN=='1'){
					// 					$.HSAPI_HEADERS.token = data.token;
					// 					localStorage.setItem('token', data.token);
					// 					$.HSAPI_HEADERS.bmh=bm;
					// 					localStorage.setItem('bmh',bm);
					// 					window.location.reload();
					// 				}
					// 			},  
					// 			error : function(data) {  
					// 				jf_alert("修改session中的部门号失败"); 
					// 			}  
					// 		});
					// 	});
					// });
					
					el.find("#menuQckRight a").unbind("click").click(function(e){
						$("#menuQckRight a").removeClass("active")
						$(this).addClass("active")
						var menuQckLeft = parseInt($("#menuQckRight").css("left"))
						var pmenucode = $(this).attr("data-pmenuCode")
						var menucode = $(this).attr("data-menucode")
						var json_menuQckRight = {"left":menuQckLeft,"pmenucode":pmenucode,"menucode":menucode}
						localStorage.setItem("menuQckRight",JSON.stringify(json_menuQckRight))
	
						if(menucode=='indexDep'){
							return false;
						}
	
						//新开窗体
						if(param.mode==='newWindow'&&e.currentTarget.id!="indexTabsPosition"){
							if(e.currentTarget.id=='indexOff'||e.currentTarget.id=='homepageOff'){
								
								jf_alert("确定注销当前用户?",function(){
									$.HSAPI_CLOSEWINS();
									localStorage.removeItem("token");
									window.location.href=param.indexOff_href;
								});
								return false;
							}
							if($.isFunction(param.newWindow)){
								if(!$(this)[0].hasAttribute('data-addtab')){
									let url=$(this).attr('data-url');
									let menuName=$(this).attr('data-name');
									let menuCode=$(this).attr('data-menuCode');
									let parentMenuCode=$(this).attr('data-pmenuCode');
									param.newWindow({'hash':url,'title':menuName,'menuCode':menuCode,'parentMenuCode':parentMenuCode,parent:true});
								}	
							}
						}
					})
					
					t.changeMenuSize();
				})
				
				el.find(".fir_next").click(function() {
					var menuQckRightWidth = el.find("#menuQck").width();
					var menuQckRightDivWidth = el.find("#menuQck").parent("div").width();
					if(menuQckRightWidth>menuQckRightDivWidth){
						if ( parseInt(el.find("#menuQck").css("left"))+150 > 20) {
							el.find("#menuQck").animate({
								left: "20"
							})
						}else{
							if ( parseInt(el.find("#menuQck").css("left")) < 20) {
								el.find("#menuQck").animate({
									left: "+=150"
								}, function() {
									if ( parseInt(el.find("#menuQck").css("left")) > 20) {
										el.find("#menuQck").css("left", "20px");
									}
								})
							}else{
								
							}
						}
					}else{
						
					}
				})
				
				el.find(".fir_prev").click(function() {
					var menuQckRightWidth = el.find("#menuQck").width();
					var menuQckRightDivWidth = el.find("#menuQck").parent("div").width();
					if(menuQckRightWidth>menuQckRightDivWidth){
						if( Math.abs(parseInt(el.find("#menuQck").css("left"))) + 150 >= menuQckRightWidth-menuQckRightDivWidth){
							el.find("#menuQck").animate({
								left: "-"+(menuQckRightWidth-menuQckRightDivWidth-20)
							})
						}else{
							if ( Math.abs(parseInt(el.find("#menuQck").css("left")))+20 < menuQckRightWidth-menuQckRightDivWidth) {
								el.find("#menuQck").animate({
									left: "-=150"
								}, function() {
									if ( Math.abs(parseInt(el.find("#menuQck").css("left"))) >= menuQckRightWidth-menuQckRightDivWidth) {
										el.find("#menuQck").css("left", "-"+(menuQckRightWidth-menuQckRightDivWidth-20)+"px");
									}
								})
							}else{
								
							}
						}
						
					}else{
						
					}
				})
				
				el.find(".sec_next").click(function() {
					var menuQckRightWidth = el.find("#menuQckRight").width();
					var menuQckRightDivWidth = el.find("#menuQckRight").parent("div").width();
					if(menuQckRightWidth>menuQckRightDivWidth){
						if ( parseInt(el.find("#menuQckRight").css("left"))+150 > 20) {
							el.find("#menuQckRight").animate({
								left: "20"
							})
						}else{
							if ( parseInt(el.find("#menuQckRight").css("left")) < 20) {
								el.find("#menuQckRight").animate({
									left: "+=150"
								}, function() {
									if ( parseInt(el.find("#menuQckRight").css("left")) > 20) {
										el.find("#menuQckRight").css("left", "20px");
									}
								})
							}else{
								
							}
						}
					}else{
						
					}
				})
				
				el.find(".sec_prev").click(function() {
					var menuQckRightWidth = el.find("#menuQckRight").width();
					var menuQckRightDivWidth = el.find("#menuQckRight").parent("div").width();
					if(menuQckRightWidth>menuQckRightDivWidth){
						if( Math.abs(parseInt(el.find("#menuQckRight").css("left"))) + 150 >= menuQckRightWidth-menuQckRightDivWidth){
							el.find("#menuQckRight").animate({
								left: "-"+(menuQckRightWidth-menuQckRightDivWidth-20)
							})
						}else{
							if ( Math.abs(parseInt(el.find("#menuQckRight").css("left")))+20 < menuQckRightWidth-menuQckRightDivWidth) {
								el.find("#menuQckRight").animate({
									left: "-=150"
								}, function() {
									if ( Math.abs(parseInt(el.find("#menuQckRight").css("left"))) >= menuQckRightWidth-menuQckRightDivWidth) {
										el.find("#menuQckRight").css("left", "-"+(menuQckRightWidth-menuQckRightDivWidth-20)+"px");
									}
								})
							}else{
								
							}
						}
						
					}else{
						
					}
				})
			
				if(localStorage.getItem("menuQck")!=null  ){
					var menuQck = JSON.parse(localStorage.getItem("menuQck"));
					var left = menuQck.left;
					el.find("#menuQck").css("left", left+"px");
					
					if(localStorage.getItem("menuQckRight")!=null  ){
						var menuQckRight = JSON.parse(localStorage.getItem("menuQckRight"));
						var left = menuQckRight.left;
						var menucode = menuQckRight.menucode;
						var pmenucode = menuQckRight.pmenucode;
						el.find("#menuQck").find("a[data-menu_code='"+pmenucode+"']").trigger("click")
						el.find("#menuQckRight").css("left", left+"px");
						el.find("#menuQckRight").find("a[data-menucode='"+menucode+"']").addClass("active")
					}else{
						var menucode = menuQck.menucode
						el.find("#menuQck").find("a[data-menu_code='"+menucode+"']").trigger("click")
					}
				}
				
				t.changeMenuSize();
				
				t.indexDowebok();

				setTimeout(function(){
					// alert(JSON.stringify(tabsMenus))
					localStorage.removeItem('addtabs_defaultTabs');
					localStorage.setItem('addtabs_defaultTabs',JSON.stringify(tabsMenus));
					$.getScript("./js/tabs/bootstrap.addtabs.js");
				},100)
			});	
			
		},
		changeMenuSize:function(){
			var t=this;
			var el = this.el;
			var param = this.param;
			
			if( localStorage.getItem("menuUpDown")!=null &&  localStorage.getItem("menuUpDown")=="menuSmall"){
				el.find("#menuQck").css("height","47px")
				el.find("#menuQck").parent("div").css("height","47px")
				el.find("#menuQck").parent("div").find(".fir_next,.fir_prev").css("height","47px").css("line-height","47px")
				el.find("#menuQck").find("span").addClass("hide")
				el.find("#menuQck").find("li").each(function(){
					$(this).attr("title",$(this).find("span").text())
				})
				
				el.find("#menuQckRight").css("height","47px")
				el.find("#menuQckRight").parent("div").css("height","47px")
				el.find("#menuQckRight").parent("div").find(".sec_next,.sec_prev").css("height","47px").css("line-height","47px")
				el.find("#menuQckRight").find("span").addClass("hide")
				el.find("#menuQckRight").find("li").each(function(){
					$(this).attr("title",$(this).find("span").text())
				})
				// el.css({"height":83});
			}else{
				el.find("#menuQck").css("height","69px")
				el.find("#menuQck").parent("div").css("height","69px")
				el.find("#menuQck").parent("div").find(".fir_next,.fir_prev").css("height","69px").css("line-height","70px")
				el.find("#menuQck").find("span").removeClass("hide")
				el.find("#menuQck").find("li").removeAttr("title")
				
				el.find("#menuQckRight").css("height","69px")
				el.find("#menuQckRight").parent("div").css("height","69px")
				el.find("#menuQckRight").parent("div").find(".sec_next,.sec_prev").css("height","69px").css("line-height","70px")
				el.find("#menuQckRight").find("span").removeClass("hide")
				el.find("#menuQckRight").find("li").removeAttr("title")
				// el.css({"height":83});
			}
		},
		indexDowebok:function(){
			var t=this;
			var el = this.el;
			var param = this.param;
			
			$(".indexDowebok").width($("#"+param.appendDivId).width()-el.find("#menu").width()-20)
            
            $.HSAPI_CALLPROCEDURE2({},'Alin_notice_boardRetrieve',{},function(data){
                if(data.RETURN>0){ 	
					// console.log(JSON.stringify(data)) 
                    var html="";
                    for(item in data.notice){
                        html+=getTextStyle(data.notice[item]);    
                    }
                    $(".indexDowebok").html(html);  
					$('.indexDowebok').liMarquee({
                        circular: false
                    });
					$(".indexDowebok").css("height","32px").css("line-height","32px").css("margin","0")
                    
                }
            },function(data){
                $.HSAPI_ALERT(JSON.stringify(data))
            })
		},
		//已打开窗体控制
		windowOpen:function(message){
			var el = this.el;
			if(message.oper=='newWindow'){
				let _openWins=new Array();
				if(localStorage.getItem('openWin')!=null)_openWins=JSON.parse(localStorage.getItem('openWin'));
				var menu = JSON.parse(localStorage.getItem("qckMenu"));
				if(message.menuCode!=''&&message.parentMenuCode!=''){
					let item = menu[message.parentMenuCode].filter(function(i) { 
						return i.menu_code ==message.menuCode; 
					});
					if(item.length>0){
						let itemOld = _openWins.filter(function(i) { 
							return i.menu_code ==item[0].menu_code; 
						});
						if(!(itemOld.length>0))
							_openWins.push(item[0])
					}
					localStorage.setItem('openWin',JSON.stringify(_openWins));
				}
			}else{
				let _openWins=JSON.parse(localStorage.getItem('openWin')||new Array());
				if(message.menuCode!=''&&message.parentMenuCode!=''){
					let item = _openWins.filter(function(i) { 
						return i.menu_code !=message.menuCode; 
					});
					localStorage.setItem('openWin',JSON.stringify(item));
				}
			}

			el.find('a[data-menu_code="homepage"]').trigger('click');
		},
		getBmh:function(resolve, reject){
			var where = {};
			var fileds={};
			var wherestring = {}
			fileds = {"fileds":{"fileds":["bh","mc"]}};
			var str=" bh != '000' and bh != '999'"
			wherestring = {"wherestring":["@@WS",str]}
			where = {where:{1:1}}
			var table={};
			table.table={"table":"bm"};				
			c= jQuery.extend({}, where,fileds,table,wherestring); 
			$.ajax({   
				type : 'POST',
				url :$.HSAPI_AJAXURL+"/qms/mobile/procedure2",
				data : $.HSAPI_ASKJSONINFO( JSON.stringify(c),'ExecRetrieveJson','{}'),
				dataType : 'json',  
				success : function(data){ 
					if(data.RETURN == 1){
						resolve(data.DATA);
					}else{
						reject(data.MSG);
					}
				},  
				error : function(data){
					reject(data);
				}  
			});
		}
	}
	
	/*
	 * 私有函数
	 * 获取站点路径
	 */
	function getContextPath(){
		var pathName = document.location.pathname;
		var index = pathName.substr(1).indexOf("/");
		var path = pathName.substr(0, index + 1);
		return path;
	}
	
})(jQuery);